package com.gateway.core;

import org.apache.mina.core.buffer.IoBuffer;

/**
 * 自定义协议
 * @author Simple
 * @date 2013-7-2 下午03:53:54
 * @Description TODO
 */
public class MyProtocol {

  private byte type;// 协议类型

  private int bodyLength;// 协议体长度

  private IoBuffer bodyData;// 协议体

  public MyProtocol(byte type, IoBuffer bodyData) {
    this.type=type;
    this.bodyLength=(bodyData == null ? 0 : bodyData.limit());
    this.bodyData=bodyData;
  }

  public void setType(byte type) {
    this.type=type;
  }

  public byte getType() {
    return type;
  }

  public void setBodyLength(int bodyLength) {
    this.bodyLength=bodyLength;
  }

  public int getBodyLength() {
    return bodyLength;
  }

  public void setBodyData(IoBuffer bodyData) {
    this.bodyData=bodyData;
  }

  public IoBuffer getBodyData() {
    return bodyData;
  }
}
